const app = getApp();
Page({
  data:{
    // text:"这是一个页面"
    day_in:app.globalData.day_in,
    day_out:app.globalData.day_out,
    headPic:app.globalData.headPic,
    all_in:app.globalData.all_in,
    all_out:app.globalData.all_out
  },
  record:function(){
    wx.navigateTo({
      url: '/pages/record/record'
    });
  },
  test:function(){
    wx.navigateTo({
      url: '/pages/chart/chart'
    });
  },
  review:function(){
    wx.navigateTo({
      url: '/pages/review/review'
    });
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    if(app.globalData.used==1){
      wx.getStorage({
        key: 'day_in',
        success(res) {
          app.globalData.day_in=res.data;
        }
      })
      wx.getStorage({
        key: 'day_out',
        success(res) {
          app.globalData.day_out=res.data;
        }
      })
      wx.getStorage({
        key: 'all_in',
        success(res) {
          app.globalData.all_in=res.data;
        }
      })
      wx.getStorage({
        key: 'all_out',
        success(res) {
          app.globalData.all_out=res.data;
        }
      })
    }
  },
  onReady:function(){
    // 页面渲染完成
    this.setData({headPic:app.globalData.headPic,
      day_in:app.globalData.day_in,
      day_out:app.globalData.day_out,
      all_in:app.globalData.all_in,
      all_out:app.globalData.all_out
    });
  },
  onShow:function(){
    // 页面显示
    this.setData({headPic:app.globalData.headPic,
      day_in:app.globalData.day_in,
      day_out:app.globalData.day_out,
      all_in:app.globalData.all_in,
      all_out:app.globalData.all_out
    });
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  remove:function(option){
    wx.clearStorageSync();
 },
})